package com.ruoyi.community.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.community.mapper.HealthyReportMapper;
import com.ruoyi.community.domain.HealthyReport;
import com.ruoyi.community.service.IHealthyReportService;

/**
 * 健康填报Service业务层处理
 *
 * @author lj
 * @date 2022-03-16
 */
@Service
public class HealthyReportServiceImpl implements IHealthyReportService {
    @Autowired
    private HealthyReportMapper healthyReportMapper;

    /**
     * 查询健康填报
     *
     * @param id 健康填报主键
     * @return 健康填报
     */
    @Override
    public HealthyReport selectHealthyReportById(Long id) {
        return healthyReportMapper.selectHealthyReportById(id);
    }

    /**
     * 查询健康填报列表
     *
     * @param healthyReport 健康填报
     * @return 健康填报
     */
    @Override
    public List<HealthyReport> selectHealthyReportList(HealthyReport healthyReport) {
        return healthyReportMapper.selectHealthyReportList(healthyReport);
    }

    /**
     * 新增健康填报
     *
     * @param healthyReport 健康填报
     * @return 结果
     */
    @Override
    public int insertHealthyReport(HealthyReport healthyReport) {
        healthyReport.setUpdateTime(DateUtils.getNowDate());
        healthyReport.setCreatTime(DateUtils.getNowDate());
        healthyReport.setDelFlag(0);
        return healthyReportMapper.insertHealthyReport(healthyReport);
    }

    /**
     * 修改健康填报
     *
     * @param healthyReport 健康填报
     * @return 结果
     */
    @Override
    public int updateHealthyReport(HealthyReport healthyReport) {
        healthyReport.setUpdateTime(DateUtils.getNowDate());
        return healthyReportMapper.updateHealthyReport(healthyReport);
    }

    /**
     * 批量删除健康填报
     *
     * @param ids 需要删除的健康填报主键
     * @return 结果
     */
    @Override
    public int deleteHealthyReportByIds(Long[] ids) {
        return healthyReportMapper.deleteHealthyReportByIds(ids);
    }

    /**
     * 删除健康填报信息
     *
     * @param id 健康填报主键
     * @return 结果
     */
    @Override
    public int deleteHealthyReportById(Long id) {
        return healthyReportMapper.deleteHealthyReportById(id);
    }

    @Override
    public int updateHealthyReportByIds(Long[] ids) {
        return healthyReportMapper.updateHealthyReportByIds(ids);
    }

    @Override
    public int selectHealthyReportByUserId(Long userId) {
        return healthyReportMapper.selectHealthyReportByUserId(userId);
    }

    @Override
    public int selectHealthyReportByUser(Long userId) {
        return healthyReportMapper.selectHealthyReportByUser(userId);
    }
}
